package com.example.communist_app_api.service.impl;

import com.example.communist_app_api.db.dao.UserSoncommentDao;
import com.example.communist_app_api.db.pojoDto.UserSoncomment;
import com.example.communist_app_api.service.UserSoncommentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Transactional
@Service
public class UserSoncommentServiceImpl implements UserSoncommentService {

    @Autowired
    private UserSoncommentDao userSoncommentDao;

    @Override
    public List<UserSoncomment> getUserComment(Integer id) {
        return userSoncommentDao.getUserComment(id);
    }

    @Override
    public int insertUserComment(Integer userId, Integer id, String context) {
        int insertNum = userSoncommentDao.insertUserComment(userId, id, context);
        return insertNum;
    }

    @Override
    public boolean deleteUserComment(Integer id) {
        return userSoncommentDao.deleteUserComment(id);
    }

    @Override
    public int isInsertUserComment(Integer userId, Integer id, String context, Integer auditorId) {
        int insertNum = userSoncommentDao.isInsertUserComment(userId, id, context,auditorId);
        return insertNum;
    }

    @Override
    public List<UserSoncomment> getUnmoderatdeComment() {
        return userSoncommentDao.getUnmoderatdeComment();
    }

    @Override
    public boolean reviewComments(Integer userId, Integer id) {
        return userSoncommentDao.reviewComments(userId, id);
    }

    @Override
    public List<UserSoncomment> getAllComment() {
        return userSoncommentDao.getAllComment();
    }
}
